package com.chinawlx.wlxteacher.network;

import rx.Observable;
import rx.subjects.PublishSubject;
import rx.subjects.SerializedSubject;
import rx.subjects.Subject;


public class WLXRxBus {

    private static final WLXRxBus mDefaultRxBus = new WLXRxBus();

    private WLXRxBus(){

    }

    public static WLXRxBus getInstance(){
        return mDefaultRxBus;
    }

    private final Subject<Object, Object> mBus = new SerializedSubject<>(PublishSubject.create());

    public void send(Object o) {
        mBus.onNext(o);
    }

    public Observable<Object> toObserverable() {
        return mBus;
    }
}
